-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add aes-encryption for backups #97
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some first comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good first PR. I have not yet finished with the review but already commit some thoughts because I cannot finish today.
return fmt.Errorf("unable to decrypt backup: %w", err) | ||
} | ||
} | ||
i.log.Info("restoring unencrypted backup with configured encryption - skipping decryption...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log line seems to be wrong because it's always shown. No matter if it was encrypted or not.
e.log.Info("read %d bytes: %s", strconv.Itoa(n), err) | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it would be more secure to do this?
e.log.Info("read %d bytes: %s", strconv.Itoa(n), err) | |
break | |
return fmt.Errorf("error reading from file (%d bytes read): %w", strconv.Itoa(n), err) |
e.log.Info("read %d bytes: %s", strconv.Itoa(n), err) | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as below.
needsBackup, err := i.db.Check(ctx) | ||
if err != nil { | ||
return fmt.Errorf("unable retrieve backup versions: %w", err) | ||
return fmt.Errorf("unable to check data of database: %w", err) | ||
} | ||
|
||
latestBackup := versions.Latest() | ||
if latestBackup == nil { | ||
i.log.Info("there are no backups available, it's a fresh database. allow database to start") | ||
if !needsBackup { | ||
i.log.Info("database does not need to be restored") | ||
return nil | ||
} | ||
|
||
i.log.Info("database potentially needs to be restored, looking for backup") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to increase availability of the DB we should do this check before validating the backups.
References
Closes #31.
References:
Additional Description
Because database can contain sensible data it should be encrypted. Adds aes-encryption to the default workflow.
Release Notes
Breaking Change
NONE
Required Actions
NONE